@extends('layout.default')

@section('layout.content')


  <div class="row">
    <div class="col-xs-12">
      <table class="table table-hover table-striped table-bordered">
        <thead>
        <tr>
          <th class="align-left" style="width:80px;">姓名</th>
          <th class="align-left" style="width:130px;">手机号码</th>
          <th class="align-left" style="width:60px;">次数</th>
          <th class="align-left"  style="width:120px;">板块</th>
          <th class="align-left">答题</th>
          <th class="align-left" style="width:160px;">答题时间</th>
        </tr>
        </thead>
        <tbody>
          @foreach ($joins as $join)
          <?php
              $count = count($join->answers);
              if($count<=0) $count = 1;
              $rowspan = $count == 1 ? '' : "rowspan='{$count}'";
              $answer = $join->answers->shift();
          ?>
          <tr class="bank">
            <td class="align-left" {!! $rowspan !!}>{{$join->name}}</td>
            <td class="align-left b" {!! $rowspan !!}>{{ $join->mobile }}</td>
            <td class="align-left" {!! $rowspan !!}>{{ $join->c }}</td>
            <td class="align-left">{{$answer->topic->name}}</td>
            <td class="align-left">{{$answer->question->title}}</td>
            <td class="align-left"><span class="grey smaller-80">{{ $answer->created_at }}</span></td>        
          </tr>

          @if($rowspan != '')
            @foreach($join->answers as $answer)
            <td class="align-left">{{$answer->topic->name}}</td>
            <td class="align-left">{{$answer->question->title}}</td>
            <td class="align-left"><span class="grey smaller-80">{{ $answer->created_at }}</span></td>
            </tr>
            @endforeach
          @endif

          @endforeach
        </tbody>
      </table>
    </div>

  </div>

@stop
@section('javascript')
<script type="text/javascript">
    $(function () {

    });
</script>
@stop
